import request from '@/utils/request.js'

// 获取房产列表
export function getProperties(params) {
  return request({
    url: '/properties',
    method: 'get',
    params
  })
}

// 行政区域查询
export function getDistrict(params) {
  return request({
    url: 'https://restapi.amap.com/v3/config/district?parameters',
    method: 'get',
    params
  })
}

// 新增房产
export function addProperty(data) {
  return request({
    url: '/properties',
    method: 'post',
    data
  })
}

// 获取指定房产
export function getPropertyDetail(id) {
  return request({
    url: '/properties/' + id,
    method: 'get'
  })
}

// 更新房产详情
export function updatePropertyDetail(data) {
  return request({
    url: '/properties/' + data.id,
    method: 'put',
    data
  })
}

// 删除房产
export function delProperty(id) {
  return request({
    url: '/properties/' + id,
    method: 'delete'
  })
}
